﻿using Microsoft.AspNetCore.Mvc;
using SwaggerDemo.Core;
using System.Collections.Generic;

namespace SwaggerDemo.Controllers;

/// <summary>
/// 用户管理
/// </summary>
[Route("api/v1/user")]
[ApiController]
[ApiExplorerSettings(GroupName = nameof(ApiVersion.V1))]
public class UserV1Controller : ControllerBase {

  /// <summary>
  /// 用户列表
  /// </summary>
  /// <returns></returns>
  [HttpGet]
  public IEnumerable<string> Get () {
    return new[] { "value1", "value2" };
  }

  /// <summary>
  /// 用户详情
  /// </summary>
  /// <param name="id"></param>
  /// <returns></returns>
  [HttpGet("{id}")]
  public string Get (int id) {
    return "value";
  }

  /// <summary>
  /// 添加用户
  /// </summary>
  /// <param name="value"></param>
  [HttpPost]
  public void Post ([FromBody] string value) {
  }

  /// <summary>
  /// 更改用户
  /// </summary>
  /// <param name="id"></param>
  /// <param name="value"></param>
  [HttpPut("{id}")]
  public void Put (int id, [FromBody] string value) {
  }

  /// <summary>
  /// 删除用户
  /// </summary>
  /// <param name="id"></param>
  [HttpDelete("{id}")]
  public void Delete (int id) {
  }
}
